package cn.tedu.sp02.service;

import cn.tedu.entity.Item;
import cn.tedu.service.ItemService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author :Colin
 * @version 创建时间: 2021/9/9 11:42
 */
@Service
@Slf4j
public class ItemServiceImpl implements ItemService {
    @Override
    public List<Item> getItems(String orderId) {
        log.info("获取商品,orderId"+orderId);
        List<Item> items = new ArrayList<>();
        items.add(new Item(1,"商品1",15));
        items.add(new Item(2,"商品2",14));
        items.add(new Item(3,"商品3",12));
        items.add(new Item(4,"商品4",11));
        items.add(new Item(5,"商品5",10));
        return items;
    }

    @Override
    public void decreaseNumber(List<Item> items) {
        for (Item item : items) {
            log.info("减少库存"+item);
        }

    }
}
